package cn.qayy.po;

import java.util.Date;

import cn.qayy.dto.StandardDTO;
import cn.qayy.utils.ArithUtil;
import cn.qayy.utils.DateUtils;

/**
 * 
 * 
 * @author wangyu
 * 标测库实体
 * 
 * @date 2018-05-31
 */
public class Standard {
    private Integer id;
    /**省份**/
    private String province="";
    /**品种**/
    private String product="";
    /**包装**/
    private String pack="";
    /**模式**/
    private String mode="";
    /**渠道**/
    private String ztype="";
    /**标准测算价**/
    private String bzcsj="0";
    /**条线**/
    private String qudao="";
    /**标测价开始时间*/
    private String stime="";
    /**标测价结束时间*/
    private String etime="";
    /**更新时间**/
    private Date mtime = new Date();

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getProvince() {
        return province;
    }

    public void setProvince(String province) {
        this.province = province == null ? null : province.trim();
    }

    public String getProduct() {
        return product;
    }

    public void setProduct(String product) {
        this.product = product == null ? null : product.trim();
    }

    public String getPack() {
        return pack;
    }

    public void setPack(String pack) {
        this.pack = pack == null ? null : pack.trim();
    }

    public String getMode() {
        return mode;
    }

    public void setMode(String mode) {
        this.mode = mode == null ? null : mode.trim();
    }

    public String getZtype() {
        return ztype;
    }

    public void setZtype(String ztype) {
        this.ztype = ztype == null ? null : ztype.trim();
    }

    public String getBzcsj() {
        return bzcsj;
    }

    public void setBzcsj(String bzcsj) {
        this.bzcsj = bzcsj == null ? null : bzcsj.trim();
    }

    public String getQudao() {
        return qudao;
    }

    public Date getMtime() {
		return mtime;
	}

	public void setMtime(Date mtime) {
		this.mtime = mtime;
	}

	public void setQudao(String qudao) {
        this.qudao = qudao == null ? null : qudao.trim();
    }
	
    public String getStime() {
		return stime;
	}

	public void setStime(String stime) {
		this.stime = stime;
	}

	public String getEtime() {
		return etime;
	}

	public void setEtime(String etime) {
		this.etime = etime;
	}

	/***
     * 通过DTO初始化
     * @param dto
     * @return
     */
	public Standard setByDTO(StandardDTO dto) {
		this.setProvince(dto.getProvince());
		this.setProduct(dto.getProduct());
		this.setPack(dto.getPack());
		this.setMode(dto.getMode());
		this.setZtype(dto.getZtype());	//渠道
		this.setQudao(dto.getQudao());	//条线
		this.setBzcsj(ArithUtil.format2bit(dto.getBzcsj()));
		this.setStime(DateUtils.parseDate(dto.getStime()));
		this.setEtime(DateUtils.parseDate(dto.getEtime()));
		return this;
	}                
}